The function BayOpt4 is the main.